<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
	
	<head>
		<meta charset="utf-8" />
		<title>后台管理系统</title>

		<meta name="description" content="data tables" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="shortcut icon" href="/Public/assets/img/favicon.png" type="image/x-icon">

		<!--Basic Styles-->
		<link href="/Public/assets/css/bootstrap.min.css" rel="stylesheet" />
		<link id="bootstrap-rtl-link" href="#" rel="stylesheet" />
		<link href="/Public/assets/css/font-awesome.min.css" rel="stylesheet" />
		<link href="/Public/assets/css/weather-icons.min.css" rel="stylesheet" />
		<link href="/Public/assets/css/ladda-themeless.min.css" rel="stylesheet" />

		<!--Fonts-->

		<!--Beyond styles-->
		<link id="beyond-link" href="/Public/assets/css/beyond.min.css" rel="stylesheet" />
		<link href="/Public/assets/css/demo.min.css" rel="stylesheet" />
		<link href="/Public/assets/css/typicons.min.css" rel="stylesheet" />
		<link href="/Public/assets/css/animate.min.css" rel="stylesheet" />
		<link href="/Public/assets/css/dataTables.bootstrap.css" rel="stylesheet" />
		<style type="text/css">
			.page-content {
				margin-left: 0;
			}
		</style>
		<script src="/Public/assets/js/jquery.min.js"></script>
		
		
	</head>
	<!-- /Head -->
	<!-- Body -->

	<body>
		
		
		
    <div class="page-content">
        <div class="page-breadcrumbs">
            <ul class="breadcrumb">
                <li>
                    <i class="fa fa-home"></i>
                    <a href="<?php echo U('dashboard/index');?>">系统首页</a>
                </li>
                <li class="">会员管理</li>
                <li class="active">会员列表</li>
            </ul>
        </div>

        <!-- Page Body -->
        <div class="page-body">
            <div class="row">
                <div class="col-lg-12 col-sm-12 col-xs-12">
                    <div class="widget">
                        <div class="widget-header bordered-left bordered-darkorange">
                            <span class="widget-caption">搜索</span>
                        </div>
                        <div class="widget-body bordered-left bordered-warning">
                            <form class="form-inline" role="form">
                                <div class="form-group">
                                    身份：
                                    <select name="identity">
                                        <option value="">全部</option>
                                        <option value="0" <?php if(($_REQUEST['identity']) == "0"): ?>disabled selected<?php endif; ?> ><?php echo userIdentity(0);?></option>
                                        <option value="9" <?php if(($_REQUEST['identity']) == "9"): ?>disabled selected<?php endif; ?> ><?php echo userIdentity(9);?></option>
                                        <option value="69" <?php if(($_REQUEST['identity']) == "69"): ?>disabled selected<?php endif; ?> ><?php echo userIdentity(69);?></option>
                                        <option value="99" <?php if(($_REQUEST['identity']) == "99"): ?>disabled selected<?php endif; ?> ><?php echo userIdentity(99);?></option>
                                        <option value="109" <?php if(($_REQUEST['identity']) == "109"): ?>disabled selected<?php endif; ?> ><?php echo userIdentity(109);?></option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <input type="text" class="form-control" name="nickname" placeholder="昵称"
                                           value="<?php echo ($_REQUEST['nickname']); ?>">
                                </div>
                                <div class="form-group">
                                    <input type="text" class="form-control" name="mobile" placeholder="手机号码"
                                           value="<?php echo ($_REQUEST['mobile']); ?>">
                                </div>
                                <div class="form-group">
                                    <input type="text" class="form-control" name="email" placeholder="邮箱"
                                           value="<?php echo ($_REQUEST['email']); ?>">
                                </div>
                                <button type="submit" class="btn btn-default">搜索</button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 col-md-12">
                    <div class="widget">
                        <table class="table table-hover">
                            <thead class=" ">
                            <tr>
                                <th class="text-center">头像</th>
                                <th>ID</th>
                                <th>昵称</th>
                                <th>真实姓名</th>
                                <th>手机</th>
                                <th>身份</th>
                                <th>注册时间</th>
                                <th>状态</th>
                                <th>操作</th>
                            </tr>
                            </thead>

                            <tbody>
                            <?php if(!empty($result)): if(is_array($result)): $i = 0; $__LIST__ = $result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): $mod = ($i % 2 );++$i;?><tr>
                                        <td class="text-center"><img style="border-radius: 5px;"
                                                                     src="<?php echo ((isset($val["avatar"]) && ($val["avatar"] !== ""))?($val["avatar"]):'/Upload/default_avatar.jpg'); ?>"
                                                                     width="40" height="40"/></td>
                                        <td><?php echo ($val["id"]); ?></td>
                                        <td><?php echo ($val["nickname"]); ?></td>
                                        <td><?php echo ($val["real_name"]); ?></td>
                                        <td><?php echo ($val["mobile"]); ?></td>
                                        <td>
                                            <select name="identity" uid="<?php echo ($val["id"]); ?>">
                                                <option
                                                <?php if(($val['identity']) == "0"): ?>disabled selected<?php endif; ?>
                                                value="0"><?php echo userIdentity(0);?></option>
                                                <option
                                                <?php if(($val['identity']) == "9"): ?>disabled selected<?php endif; ?>
                                                value="9"><?php echo userIdentity(9);?></option>
                                                <option
                                                <?php if(($val['identity']) == "69"): ?>disabled selected<?php endif; ?>
                                                value="69"><?php echo userIdentity(69);?></option>
                                                <option
                                                <?php if(($val['identity']) == "99"): ?>disabled selected<?php endif; ?>
                                                value="99"><?php echo userIdentity(99);?></option>
                                                <option
                                                <?php if(($val['identity']) == "109"): ?>disabled selected<?php endif; ?>
                                                value="109"><?php echo userIdentity(109);?></option>
                                            </select>
                                        </td>
                                        <td class="center "><?php echo (format_time($val["reg_time"])); ?></td>
                                        <td class="center ">
                                            <div class="btn-group">
                                                <?php if(($val["status"]) == "ACTIVE"): ?><a class="btn btn-sm btn-palegreen">正常</a>
                                                    <a class="btn btn-sm btn-palegreen dropdown-toggle"
                                                       data-toggle="dropdown" aria-expanded="false"><i
                                                            class="fa fa-angle-down"></i></a>
                                                    <ul class="dropdown-menu palegreen" role="menu">
                                                        <li>
                                                            <a href="<?php echo U('user/lock',['id'=>$val['id']]);?>"
                                                               data-confirm="确认锁定该会员？">锁定</a>
                                                        </li>
                                                    </ul>
                                                    <?php else: ?>
                                                    <a class="btn btn-sm btn-danger">锁定</a>
                                                    <a class="btn btn-sm btn-danger dropdown-toggle"
                                                       data-toggle="dropdown" aria-expanded="false"><i
                                                            class="fa fa-angle-down"></i></a>
                                                    <ul class="dropdown-menu danger" role="menu">
                                                        <li>
                                                            <a href="<?php echo U('user/unlock',['id'=>$val['id']]);?>"
                                                               data-confirm="确认解锁该会员？">解除锁定</a>
                                                        </li>
                                                    </ul><?php endif; ?>
                                            </div>

                                        </td>

                                        <td class="center ">
                                            <a href="<?php echo U('user/detail',['id'=>$val['id']]);?>"
                                               class="btn btn-default btn-xs black"><i class="fa fa-tasks"></i> 详细</a>
                                            <!--<a href="<?php echo U('user/pay',['id'=>$val['id']]);?>"-->
                                               <!--class="btn btn-default btn-xs black"><i class="fa fa-money"></i> 账户</a>-->
                                            <a href="<?php echo U('user/password',['id'=>$val['id']]);?>"
                                               class="btn btn-default btn-xs black ajax-load">修改密码</a>
                                        </td>
                                    </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                                <?php else: ?>
                                <tr>
                                    <td colspan="8" align="center">没有数据</td>
                                </tr><?php endif; ?>
                            </tbody>
                        </table>
                        <div class="row DTTTFooter">
                            <div class="col-sm-6">
                                <div class="dataTables_info" id="simpledatatable_info" role="status" aria-live="polite">

                                </div>
                            </div>
                            <div class="col-sm-6">
                                <div class="dataTables_paginate paging_bootstrap" id="simpledatatable_paginate">
                                    <?php echo ($page); ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
        <!-- /Page Body -->
    </div>


				<!--Basic Scripts-->
		
		<script src="/Public/assets/js/bootstrap.min.js"></script>
		<script src="/Public/assets/js/slimscroll/jquery.slimscroll.min.js"></script>
		<script src="/Public/assets/js/fuelux/spinbox/fuelux.spinbox.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="/Public/assets/js/loading/spin.js" type="text/javascript" charset="utf-8"></script>
		<script src="/Public/assets/js/loading/ladda.js" type="text/javascript" charset="utf-8"></script>
		<script src="/Public//assets/js/bootstrap-modalmanager.js" type="text/javascript" charset="utf-8"></script>
		<!--Beyond Scripts-->
		<script src="/Public/assets/js/beyond.js"></script>
		<script src="/Public/assets/js/toastr/toastr.js"></script>
		<script src="/Public/assets/js/bootbox/bootbox.js"></script>
		<script src="/Public/assets/js/common.js"></script>
		
    <script>
        $(function () {
            $("select[name='identity']").change(function (e) {
                var identity = $(this).val();
                var uid = $(this).attr('uid');
                if (!isNaN(identity) && !isNaN(uid)) {
                    $.ajax({
                        url: "<?php echo U('User/identity');?>",
                        type: 'post',
                        data: {id: uid, identity: identity},
                        dataType: 'json',
                        success: function (result) {
                            tips(result.message);
                        }, error: function () {
                            tips('发生错误');
                        }
                    })
                }
            });
        })
    </script>


	</body>
	<!--  /Body -->
	<script>
		 <?php if (!IS_AJAX) { $success_message = session('__SUCCESS_MESSAGE'); if ($success_message) { echo "tips('".$success_message. "');"; } session('__SUCCESS_MESSAGE', null); $error_message = session('__ERROR_MESSAGE'); if ($error_message) { echo "tips('".$error_message. "','danger');"; } session('__ERROR_MESSAGE', null); } ?>
	
	if(parent && typeof parent._attachEvent == 'function'){
		parent._attachEvent(document.documentElement, 'keydown', parent.resetF5);
	}
	</script>

</html>